
import { uploadData, getPosition, getStruct, pushRateToList, readExel } from '../batch'

module.exports = function (params) {

    let exel = getStruct(params.downloadUrl);
    let exelList = []

    console.log("批量录入了..........")

    readExel({
        lines: exel.lines,
        cols: exel.columns,
        table: exel.table,
        eachLine(arr) {
            var row = {
                'tFirst1': arr[0],
                'tFirst1Info': arr[1],
                'tFirst2': arr[2],
                'tFirst2Info': arr[3],
                'tSencond1': arr[4],
                'tSencond1Info': arr[5],
                'tSencond2': arr[6],
                'tSencond2Info': arr[7],
                'tThird1': arr[8],
                'tThird1Info': arr[9],
                'tThird2': arr[10],
                'tThird2Info': arr[11],
            }
            exelList.push(row);

        }
    })

    console.log('-----------------解析数据-----\n\n',exelList)

    return uploadData({
        url: "bath/pre-purchase-service",
        data: exelList,
        successData: {
            code:1
        },
        errData: {

        },
        token: params.token
    })
}